$(function(){
	$("#main_menu").tree({
		url:'/systemMenu/indexMenu',
		onClick:function(node){
			var mainTabs = $("#main_tabs");
			//判断当前点击的节点是否已经创建对应的面板了?
			if(mainTabs.tabs("exists",node.text)){
				//选中选项卡
				mainTabs.tabs("select",node.text);
			}else{
				//新增选项卡
				//找到选项卡,往选项卡中添加面板
				mainTabs.tabs("add",{
					title:node.text,
					closable:true,
                    iconCls:node.iconCls,
					//href:node.attributes.url//只能加载远程页面中的body部分的内容
					content:'<iframe src="'+node.attributes.url+'" style="width:100%;height:100%" frameborder="0"></iframe>'
				});
			}
		}
	});
	//
    $("#main_tabs").tabs({
        fit:true,
        pill:true
    });
});

function change() {
    var mainTabs = $("#main_tabs");
    console.log(mainTabs)
// //判断当前点击的节点是否已经创建对应的面板了?
    if (mainTabs.tabs("exists","修改密码")) {
        //选中选项卡
        mainTabs.tabs("select", "修改密码");
    } else {
        //新增选项卡
        //找到选项卡,往选项卡中添加面板
        mainTabs.tabs("add", {
            title: "修改密码",
            closable: true,
            // iconCls: node.iconCls,
            //href:node.attributes.url//只能加载远程页面中的body部分的内容
            content: '<iframe src="/changePassword" style="width:100%;height:100%" frameborder="0"></iframe>'
        });
    }
}

function showCurrentDate(){
    var today,hour,second,minute,year,month,date;
    var strDate ;
    today=new Date();
    var n_day = today.getDay();
    switch (n_day)
    {
        case 0:{
            strDate = "星期日"
        }break;
        case 1:{
            strDate = "星期一"
        }break;
        case 2:{
            strDate ="星期二"
        }break;
        case 3:{
            strDate = "星期三"
        }break;
        case 4:{
            strDate = "星期四"
        }break;
        case 5:{
            strDate = "星期五"
        }break;
        case 6:{
            strDate = "星期六"
        }break;
        case 7:{
            strDate = "星期日"
        }break;
    }
    year = today.getYear()+1900;
    month = today.getMonth()+1;
    if(month<10){
        month="0"+month;
    }
    date = today.getDate();
    if(date<10){
        date="0"+date;
    }
    hour = today.getHours();
    if(hour<10){
        hour="0"+hour;
    }
    minute =today.getMinutes();
    if(minute<10){
        minute="0"+minute;
    }
    second = today.getSeconds();
    if(second<10){
        second="0"+second;
    }
    document.getElementById('currentDate').innerHTML = year + ":" + month + ":" + date + " " + strDate +" " + hour + ":" + minute + ":" + second; //显示时间
    window.setTimeout('showCurrentDate()',1000);
}

$(function () {
    showCurrentDate();
});